import request from "@/utils/request";
var baseUrl = '/user/plan/'

export function findAllPlans(page, size) {
  return request({
    url: baseUrl+'findAllPlans',
    method: 'post',
    params: {page, size}
  })
}

export function findListPlans(size) {
  return request({
    url: baseUrl+'findListPlans',
    method: 'post',
    params: {size}
  })
}

export function findPlan(id) {
  return request({
    url: baseUrl+'findDetail',
    method: 'get',
    params: {id}
  })
}

export function joinPlan(id) {
  return request({
    url: baseUrl+'joinPlan',
    method: 'post',
    params: {id}
  })
}

export function cancelPlan(id) {
  return request({
    url: baseUrl+'cancelPlan',
    method: 'post',
    params: {id}
  })
}

export function clockInPlan(id) {
  return request({
    url: baseUrl+'clockInPlan',
    method: 'post',
    params: {id}
  })
}

export function clockOutPlan(id) {
  return request({
    url: baseUrl+'clockOutPlan',
    method: 'post',
    params: {id}
  })
}

export function getMyPlanByTime(date) {
  return request({
    url: baseUrl+'getMyPlans/byTime',
    method: 'get',
    params: {date}
  })
}

export function addPlan(plan) {
  return request({
    url: baseUrl+'addPlan',
    method: 'post',
    data: plan
  })
}

export function matchPlan() {
  return request({
    url: baseUrl+'matchPlan',
    method: 'get',
  })
}
